package phoenix.mob_android.test_suites.wildbuddies.critical;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import phoenix.core.base.TestSuiteBase;
import phoenix.core.data_models.TestUserDataModel;
import phoenix.core.data_models.UserProfileDataModel.LookingFor;
import phoenix.core.data_models.UserProfileDataModel.PaymentDetails;
import phoenix.core.data_models.UserProfileDataModel.ProfileDetails;
import phoenix.mob_android.test_objects.CommunicationTests;
import phoenix.mob_android.test_objects.LoginTests;
import phoenix.mob_android.test_objects.MainMenuTests;
import phoenix.mob_android.test_objects.PaymentTests;
import phoenix.mob_android.test_objects.ProfileTests;
import phoenix.mob_android.test_objects.RegistrationTests;
import phoenix.mob_android.test_objects.SearchTests;
import phoenix.mob_android.test_objects.SettingsTests;
import phoenix.mob_site.test_objects.BackendTests;

public class CriticalTS extends TestSuiteBase
{

	RegistrationTests indexPageTests = new RegistrationTests(phoenix);
	BackendTests backendTests = new BackendTests(phoenix);
	LoginTests loginTests = new LoginTests(phoenix);
	MainMenuTests mainMenuTests = new MainMenuTests(phoenix);
	ProfileTests profileTests = new ProfileTests(phoenix);
	SettingsTests settingsTests = new SettingsTests(phoenix);
	CommunicationTests communicationTests = new CommunicationTests(phoenix);
	SearchTests searchTests = new SearchTests(phoenix);
	PaymentTests paymentTests = new PaymentTests(phoenix);

	@DataProvider
	public Object[][] registrationDataSmokeFull()
	{
		return indexPageTests.dataProviders.registrationDataSmokeMale();
	}

	@DataProvider
	public Object[][] myProfileData()
	{
		return profileTests.dataProviders.myProfileFillData();
	}

	@DataProvider
	public Object[][] userProfileData()
	{
		return profileTests.dataProviders.userProfileData();
	}

	@DataProvider
	public Object[][] settingsData()
	{
		return settingsTests.dataProviders.settingsData();
	}

	@DataProvider
	public Object[][] searchProfileData()
	{
		return searchTests.dataProviders.searchProfileData();
	}

	@DataProvider
	public Object[][] chatData()
	{
		return communicationTests.dataProviders.chatData();
	}

	@DataProvider
	public Object[][] paymentData()
	{
		return paymentTests.dataProviders.paymentPackageData();
	}

	@DataProvider
	public Object[][] featureData()
	{
		return paymentTests.dataProviders.featuresData();
	}

	/**
	 * ---------------------------Preparation for Main Tests of Redirects to Pp
	 */

	@Test(dataProvider = "registrationDataSmokeFull", priority = 1, enabled = true)
	public void registrationMaleTest(TestUserDataModel p_userData, String p_regEmail, String p_correct_pass, String p_email_with_space,
			String p_email_with_point,
			String p_email_with_dog, String p_email_with_two_dog, String p_email_with_dog_and_point, String p_short_pass, String p_long_pass)
	{
		indexPageTests.registrationValidationStepsTest(p_userData, p_regEmail, p_correct_pass, p_email_with_space, p_email_with_point, p_email_with_dog,
				p_email_with_two_dog, p_email_with_dog_and_point, p_short_pass, p_long_pass);
	}

	@Test(dependsOnMethods = "registrationMaleTest", priority = 2, enabled = true)
	public void getUserDataMaleTest()
	{
		backendTests.getUserDataTest(testUser().getEmail());
	}

	@Test(dependsOnMethods = "registrationMaleTest", priority = 3, enabled = true)
	public void logoutTest()
	{
		loginTests.loginTest();
	}

	@Test(dependsOnMethods = "registrationMaleTest", priority = 4, enabled = true)
	public void mainMenuTest()
	{
		mainMenuTests.mainMenuTests();
	}

	@Test(dependsOnMethods = "registrationMaleTest", dataProvider = "myProfileData", priority = 5, enabled = true)
	public void profileTest(ProfileDetails p_profileDetails, LookingFor p_profileLookingFor)
	{
		profileTests.profileTest(p_profileDetails, p_profileLookingFor);
	}

	@Test(dependsOnMethods = "registrationMaleTest", dataProvider = "settingsData", priority = 6, enabled = true)
	public void settingTest(String p_nameUniquePrefix)
	{
		settingsTests.settingTests(p_nameUniquePrefix);
	}

	@Test(dependsOnMethods = "registrationMaleTest", dataProvider = "chatData", priority = 7, enabled = true)
	public void chatroomsTest(String p_message, int p_chatNum)
	{
		communicationTests.chatroomsTest(p_message, p_chatNum);
	}

	@Test(dependsOnMethods = "registrationMaleTest", priority = 8, enabled = true)
	public void searchTest()
	{
		searchTests.searchTest();
	}

	@Test(dependsOnMethods = "registrationMaleTest", priority = 9, enabled = true)
	public void searchActionsTest()
	{
		searchTests.searchActionsTest();
	}

	/*--------------------------- Block with redirects to PP ---------------------------*/

	@Test(dependsOnMethods = "registrationMaleTest", priority = 10, enabled = true)
	public void redirectsPPFromMainMenu()
	{
		mainMenuTests.redirectPPFromMainMenu();
	}

	@Test(dependsOnMethods = "registrationMaleTest", dataProvider = "chatData", priority = 11, enabled = true)
	public void redirectsPPSendTwoChatMessages(String p_message, int p_chatNum)
	{
		communicationTests.redirectPPTwoChatMessagesTest(p_message);
	}

	@Test(dependsOnMethods = "registrationMaleTest", priority = 12, enabled = true)
	public void redirectsPPSearchPageGridTest()
	{
		searchTests.redirectPPSearchPageGridTest();
	}

	@Test(dependsOnMethods = "registrationMaleTest", priority = 13, enabled = true)
	public void redirectsPPSearchPageListTest()
	{
		searchTests.redirectPPSearchPageListTest();
	}

	@Test(dependsOnMethods = "registrationMaleTest", dataProvider = "searchProfileData", priority = 14, enabled = true)
	public void redirectsPPProfileUpgradeButton(int p_numberProfile)
	{
		profileTests.redirectPPProfileUpgradeButton(p_numberProfile);
	}

	@Test(dependsOnMethods = "registrationMaleTest", dataProvider = "paymentData", priority = 15, enabled = true)
	public void paymentTests(Integer p_membershipPackage, PaymentDetails p_paymentDataParams, boolean p_expected)
	{
		paymentTests.paymentTest(p_membershipPackage, p_paymentDataParams, p_expected);
	}

	@Test(dependsOnMethods = "registrationMaleTest", priority = 16, enabled = true)
	public void checkForBannersInSearchPayTests()
	{
		searchTests.checkForBannersInSearchAfterPay();
	}

	@Test(dependsOnMethods = "registrationMaleTest", dataProvider = "userProfileData", priority = 17, enabled = true)
	public void userProfileTests(int p_numberProfile, String p_message)
	{
		profileTests.userProfilePageTest(p_numberProfile, p_message);
	}

	@Test(dependsOnMethods = "paymentTests", priority = 18, enabled = true)
	public void featuresTests()
	{
		paymentTests.featuresTest();
	}
}
